import http from '@/utils/request';

export default {
  /**
   * 查询部门列表
   * @param param 
   * @returns 
   */
  async getDepartmentList(param) {
    return await http.get("/api/department/list", param)
  },
  /**
   * 获取所属部门列表
   * @returns 
   */
  async getParentTreeList() {
    return await http.get("/api/department/parent/list");
  },
  /**
   * 新增部门信息
   * @param params 
   * @returns 
   */
  async addDept(params) {
    return http.post("/api/department/add", params);
  },
  /**
   * 修改部门信息
   * @param {*} params 
   * @returns 
   */
  async updateDept(params) {
    return http.put("/api/department/update", params);
  },
  /**
   * 检查部门下是否存在子部门
   * @param {*} params 
   * @returns 
   */
  async checkDepartment(params) {
    return http.getRestApi("/api/department/check", params);
  },
  /**
   * 根据部门id删除部门
   * @param {*} params 
   * @returns 
   */
  async deleteById(params) {
    return http.delete("/api/department/delete", params);
  }
}